from primes import totient_gen

limit = 1000 * 1000

print sum(t for t in totient_gen(limit)) - 1